//
//  RankingListCell.m
//  NewPro
//
//  Created by RYX on 2019/1/8.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "RankingListCell.h"
#import "RankingListModel.h"

@interface RankingListCell ()
{
    
    __weak IBOutlet UILabel *noLa;
    __weak IBOutlet UIImageView *im;
    __weak IBOutlet UILabel *nameLa;
    __weak IBOutlet UILabel *moneyLa;
}

@end

@implementation RankingListCell

+ (instancetype)tempWithTableView:(UITableView *)tableView{
    
    RankingListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CELL"];
    if (!cell) {
        
        cell = [self cell];
    }
    
    return cell;
}

+ (CGFloat)getHeight{
    
    UITableViewCell *cell = [self cell];
    return cell.frame.size.height;
}

+ (instancetype)cell{
    
    ClassName
    return [[[NSBundle mainBundle] loadNibNamed:className owner:self options:nil] objectAtIndex:0];
}


- (void)setModel:(RankingListModel *)model{
    
    NSInteger no = self.indexPath.section + 1;
    noLa.text = [NSString stringWithFormat:@"NO.%ld",(long)no];
    
    nameLa.text = model.customName;
    
    moneyLa.text = [NSString stringWithFormat:@"%@%@",model.value,self.unit];
    
    noLa.textColor = UIColor.blackColor;
    im.image = [UIImage imageNamed:@""];
    
    if (no <= 3) {
        
        noLa.text = [NSString stringWithFormat:@"TOP %ld",(long)no];
        noLa.textColor = UIColor.redColor;
        im.image = [UIImage imageNamed:[NSString stringWithFormat:@"img_top%ld",(long)no]];
    }
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
